import React from "react";
export default function MemoHoc(UserCom) {
  return class extends React.Component {
    shouldComponentUpdate(props, state) {
      let shouldUpdate = false;
      for (let item in props) {
        if (this.props[item] !== props[item]) {
          return (shouldUpdate = true);
        }
      }
      for (let item in state) {
        if (this.state[item] !== state[item]) {
          return (shouldUpdate = true);
        }
      }
      console.log(shouldUpdate, "shouldUpdate");
      return shouldUpdate;
    }
    render() {
      return (
        <>
          <UserCom name="小猪" {...this.props}></UserCom>
        </>
      );
    }
  };
}
